package com.brush.web.controller.logininfor;

import com.brush.common.core.controller.BaseController;
import com.brush.common.core.domain.R;
import com.brush.system.domain.req.syslogininfor.SysLoginInforReq;
import com.brush.system.domain.resp.syslogininfor.SysLoginInforResp;
import com.brush.system.service.SysLogininforService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * ClassName: SysLoginInfor
 * Package: com.brush.web.controller.logininfor
 * Description:
 *
 * @Author luo
 * @Create 2024/8/23 16:32
 * @Version 1.0
 */
@Api(tags = "后台-登录日志api")
@RestController
@RequestMapping(value = "/admin/logininfor")
public class SysLoginInforController extends BaseController {

    @Autowired
    private SysLogininforService sysLogininforService;

    @ApiOperation(value = "分页查询")
    @GetMapping(value = "/list")
    public R<PageInfo<SysLoginInforResp>> list(SysLoginInforReq req) {
        PageInfo<SysLoginInforResp> pageInfo = this.sysLogininforService.paginationQueryInfor(req);
        return R.ok(pageInfo);
    }

    @ApiOperation(value = "根据id查询")
    @GetMapping("/{id}")
    @PreAuthorize("@ss.hasPermi('system:logininfor:query')")
    public R<SysLoginInforResp> findById(@PathVariable(value = "id") Long id) {
        SysLoginInforResp sysLoginInforResp = this.sysLogininforService.findById(id);
        return R.ok(sysLoginInforResp);
    }

}
